<template>
	<view>

	</view>
</template>

<script>
	import {
		queryagreeinfo,
		signAcctAgreement,
		openAcct
	} from '@/api/register.js'

	export default {
		data() {
			return {

			};
		},
		onShow() {
			uni.showLoading({
				mask: true
			})
			queryagreeinfo('').then(res => {
				uni.showLoading({
					mask: true
				})
				if (res.status === 200) {
					if (res.data === []) {
						uni.showLoading({
							mask: true
						})
						signAcctAgreement('').then(t => {
							if (t.status === 400) {
								openAcct('').then(s => {
									console.log(s)
									if (s.status === 200) {
										uni.showToast({
											title: s.msg,
											icon: 'success'
										})
										uni.navigateTo({
											url: '/pages/register/bank/bank'
										})
									}
								})
							}
						})
					} else {
						uni.showLoading({
							mask: true
						})
						openAcct({}).then(t => {
							console.log(t)
							if (t.status === 200) {
								uni.showToast({
									title: t.msg,
									icon: 'success'
								})
								uni.navigateTo({
									url: '/pages/register/bank/bank'
								})
							}
						})
					}
				}
			})
		}
	}
</script>

<style lang="scss">

</style>
